package com.edu.exam.enums.grading;

import com.edu.exam.enums.core.BaseEnum;

import java.util.Arrays;

/**
 * 边框样式枚举
 * 管理批注系统中各种边框样式
 *
 * @author System
 * @version 1.0.0
 */
public enum BorderStyle implements BaseEnum {

    // === 基础边框样式 ===
    SOLID("SOLID", "实线"),
    DASHED("DASHED", "虚线"),
    DOTTED("DOTTED", "点线"),
    DOUBLE("DOUBLE", "双线"),

    // === 渐变边框样式 ===
    DASH_DOT("DASH_DOT", "点划线"),
    DASH_DOT_DOT("DASH_DOT_DOT", "双点划线"),
    LONG_DASH("LONG_DASH", "长虚线"),
    MEDIUM_DASH("MEDIUM_DASH", "中虚线"),
    SHORT_DASH("SHORT_DASH", "短虚线"),
    LONG_DASH_DOT("LONG_DASH_DOT", "长点划线"),
    MEDIUM_DASH_DOT("MEDIUM_DASH_DOT", "中点划线"),
    SHORT_DASH_DOT("SHORT_DASH_DOT", "短点划线"),

    // === 特殊边框样式 ===
    DOTTED_DASH("DOTTED_DASH", "点虚线"),
    DOTTED_DASH_DOT("DOTTED_DASH_DOT", "点虚点划线"),
    DOTTED_DOUBLE("DOTTED_DOUBLE", "点双线"),
    WAVE("WAVE", "波浪线"),
    ZIGZAG("ZIGZAG", "锯齿线"),
    SCROLL("SCROLL", "卷曲线"),
    DOUBLE_WAVE("DOUBLE_WAVE", "双波浪线");

    private final String code;
    private final String description;

    BorderStyle(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public static BorderStyle fromCode(String code) {
        return Arrays.stream(values())
                .filter(e -> e.getCode().equals(code))
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("Unknown border style code: " + code));
    }
    @Override
    public String toString() {
        return description;
    }
}